import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import piniaPluginPersist from 'pinia-plugin-persist'
import 'normalize.css/normalize.css'
import 'element-plus/theme-chalk/src/message.scss'
import 'element-plus/theme-chalk/src/message-box.scss'
import 'element-plus/theme-chalk/el-overlay.css'
import App from './App.vue'
import router from './router'
const app = createApp(App)

import * as Icons from '@element-plus/icons-vue'
Object.keys(Icons).forEach((key) => {
    app.component(key, Icons[key as keyof typeof Icons]);
})

// element
import Table from '@/components/ElementCom/table.vue'
import Pagination from '@/components/ElementCom/table-pagination.vue'
import SearchBar from '@/components/ElementCom/table-searchBar.vue'
app.component('Table', Table)
app.component('Pagination', Pagination)
app.component('SearchBar', SearchBar)
app.use(ElementPlus, {
    locale: zhCn,
})

const store = createPinia()
store.use(piniaPluginPersist)
app.use(store)
app.use(router)

app.mount('#app')